package 面向对象;

import org.junit.Test;

import java.util.Scanner;

public class demo {
    @Test
    public void test1(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入学生数量: ");
        int count = scanner.nextInt();
        Student[] students = new Student[count];
        for (int i = 0; i < students.length; i++) {
            students[i] = new Student();
            System.out.println("第"+i+"个学生--");
            System.out.println("姓名: ");
            students[i].name = scanner.next();
            System.out.println("年龄: ");
            students[i].age=scanner.nextInt();
        }
        System.out.println(students[0].toString());
        System.out.println(students);
        System.out.println("录入成功");
    }
    @Test
    public void test2(){
        Student student = new Student(2,"zhangsan",23,"男");
        System.out.println(student);
    }

}
